package com.kly.domain.enums;

import lombok.Getter;

/**
 * @author admin
 * @date 2025/3/11
 */
@Getter
public enum SpaceLevelEnum {
//     普通，专业，旗舰
    COMMON("普通版", 0, 1000L, 100L * 1024 * 1024),
    PROFESSIONAL("专业版", 1, 10000L, 500L * 1024 * 1024),
    FLAGSHIP("旗舰版", 2, 100000L, 1000L * 1024 * 1024),
    ;

    /**
     * 名称
     */
    private final String name;

    /**
     * 等级
     */
    private final Integer level;

    /**
     * 最大数量
     */
    private final Long maxCount;


    /**
     * 最大空间
     */
    private final Long maxSize;


    SpaceLevelEnum(String name, Integer level, Long maxCount, Long maxSize) {
        this.name = name;
        this.level = level;
        this.maxCount = maxCount;
        this.maxSize = maxSize;
    }


    /**
     * 获取枚举值
     */
    public static SpaceLevelEnum getEnumByLevel(Integer level) {
        if(level == null) {
            return null;
        }
        for (SpaceLevelEnum value : values()) {
            if (value.getLevel().equals(level)) {
                return value;
            }
        }
        return null;
    }
}
